<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户注册</title>
    <style>
        .alert {
            padding: 15px;
            margin-bottom: 20px;
            border: 1px solid transparent;
            border-radius: 4px;
        }
        .alert-success {
            color: #3c763d;
            background-color: #dff0d8;
            border-color: #d6e9c6;
        }
        .alert-error {
            color: #a94442;
            background-color: #f2dede;
            border-color: #ebccd1;
        }
    </style>
</head>
<body>
<!-- 添加成功消息显示 -->
<div th:if="${success}" class="alert alert-success" role="alert">
    <span th:text="${success}"></span>
</div>
<!-- 添加错误消息显示 -->
<div th:if="${error}" class="alert alert-error" role="alert">
    <span th:text="${error}"></span>
</div>

<!--th:object:用于绑定实体类对象-->
<!--th:field:将输入框的值绑定到user对象的属性上-->
<form action="/register" method="post" th:object="${user}">
    账号<input type="text" name="username" th:field="*{name}">
    密码<input type="password" name="password" th:field="*{password}">
    性别<input type="text" name="sex" th:field="*{sex}">
    <input type="submit" value="提交">
</form>
</body>
</html>